<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script>
$(function(){
	$(".msg_show").click(function(){
		var url = $(this).attr("href");
		window.open(url,"쪽지 보기","width=250,height=280,menubar=no,toolbar=no, menubar=no, resizable=no,");
		return false;
	});
});
</script>
<div id="sendBox">
	<h2>보낸 쪽지함</h2>
	<c:choose>
		<c:when test="${requestScope.list.list[0]==null }">
			<p>보낸 쪽지가 없습니다.</p>
		</c:when>
		<c:otherwise>
			<table style="margin: 0;">
				<thead>
					<tr style="margin: 20px;">
						<th>받는사람</th>
						<th>제목</th>
						<th>일시</th>
						<th>비고</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach var="send" items="${requestScope.list.list }">
						<tr style="margin: 20px;">
							<td>${send.to.nickname }</td>
							<td><a href="sns.do?mode=sendMsg&no=${send.no }"
								class="msg_show">${send.title }</a></td>
							<td>${send.w_date }</td>
							<td><a
								href="sns.do?mode=deleteMsg&uid=${sessionScope.mvo.uId }&no=${send.no }&boxType=send">삭제</a>
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</c:otherwise>
	</c:choose>
	<div id="sendPaging">
		<c:set var="pb" value="${requestScope.list.pagingBean }"></c:set>
		<c:if test="${pb.previousPageGroup }">
			<a
				href="sns.do?mode=sendMsgList&uid=${sessionScope.mvo.uId }&page=${pb.startPageOfPageGroup-1 }">
				<img src="${initParam.root }/img/left_arrow_btn.gif">
			</a>
		</c:if>

		<c:forEach var="ppg" begin="${pb.startPageOfPageGroup}"
			end="${pb.endPageOfPageGroup}" step="1">
			<c:choose>
				<c:when test="${pb.nowPage!=ppg}">
					<a
						href="sns.do?mode=sendMsgList&uid=${sessionScope.mvo.uId }&page=${ppg}">${ppg
						}</a>
				</c:when>
				<c:otherwise>
		   ${ppg}
	    </c:otherwise>
			</c:choose>
		</c:forEach>

		<c:if test="${pb.nextPageGroup }">
			<!-- 다음 그룹의 시작페이지 -->
			<a
				href="sns.do?mode=sendMsgList&uid=${sessionScope.mvo.uId }&page=${pb.endPageOfPageGroup+1 }">
				<img src="${initParam.root }/img/right_arrow_btn.gif">
			</a>
		</c:if>
	</div>
</div>
